import type { SiteConfig } from '@/store/config';
import type { CategoryByWebsiteCode } from './type';
export * from './type';

/**
 * 获取所有站点列表
 * @returns
 */
export const fetchWebsiteList = () =>
  get<SiteConfig[]>(Prefix.api + '/website/list');

/**
 * 根据网站编码查询类目
 * @param params
 * @returns
 */
export const fetchCategoryByWebsiteCode = (params: {
  websiteCode: string;
  hasSplits?: boolean;
  removeOrigin?: boolean;
}) =>
  get<CategoryByWebsiteCode>(
    Prefix.api + '/category/origin-categories',
    params
  );

/**
 * 查询网站条件
 * @param params
 * @returns
 */
export const fetchCategoryConditions = (params: {
  websiteCode: string;
  categoryId: string | number;
}) => get<string>(Prefix.api + '/category/origin-category-conditions', params);
